// 粒子类型
export interface Particle {
  x: number;
  y: number;
  size: number;
  color: string;
  speedX: number;
  speedY: number;
  life: number;
  maxLife: number;
  id: number;
  opacity: number;
  mergeCount: number;
  merging: boolean;
  mergingWith?: Particle;
  mergeProgress: number;
  mergePartner?: number; // 合并伙伴的ID
  mergeTargetX?: number; // 合并目标X坐标
  mergeTargetY?: number; // 合并目标Y坐标
  mergeStartSize?: number; // 合并前的大小
  mergeTargetSize?: number; // 合并后的目标大小
  exploding: boolean;
  explosionProgress: number;
  explosionParticles?: ExplosionFragmentParticle[]; // 爆炸产生的小粒子
  attractedToMouse: boolean;
  gravitySources: Particle[];
  attractingParticles?: number[]; // 被该粒子吸引的粒子ID列表
}

// 爆炸碎片粒子类型
export interface ExplosionFragmentParticle {
  x: number;
  y: number;
  size: number;
  speedX: number;
  speedY: number;
  opacity: number;
}

// 爆炸粒子类型
export interface ExplosionParticle {
  x: number;
  y: number;
  size: number;
  color: string;
  speedX: number;
  speedY: number;
  life: number;
  maxLife: number;
  opacity: number;
}

// 机器人类型
export interface Robot {
  x: number;
  y: number;
  size: number;
  targetX: number;
  targetY: number;
  speed: number;
  isThinking: boolean;
  thoughtBubbles?: {
    x: number;
    y: number;
    size: number;
    opacity: number;
  }[];
  lastThoughtTime?: number;
  // 新增眨眼动画相关属性
  lastBlinkTime?: number;
  eyeState?: {
    left: {
      open: boolean;
      blinkProgress: number;
    };
    right: {
      open: boolean;
      blinkProgress: number;
    };
  };
  observingMerge: boolean; // 是否正在观察粒子合并
  pauseMovement: number; // 暂停移动的时间计数器
}

// 连接线类型
export interface ConnectionLine {
  particle1?: Particle;
  particle2?: Particle;
  x1: number;
  y1: number;
  x2: number;
  y2: number;
  distance?: number;
  pulseOffset?: number;
  strength?: number;
  alpha: number;
  color: string;
  id: string;
  progress?: number;
}

// 性能模式类型
export enum PerformanceMode {
  High = 'high',
  Medium = 'medium',
  Low = 'low'
}

// 画布上下文类型
export type CanvasContext = CanvasRenderingContext2D;

// 鼠标位置类型
export interface MousePosition {
  x: number;
  y: number;
}

// 粒子系统状态类型
export interface ParticleSystemState {
  particles: Particle[];
  explosionParticles: ExplosionParticle[];
  connectionLines: ConnectionLine[];
  robot: Robot;
  performanceMode: PerformanceMode;
  mousePosition: MousePosition;
  canvasWidth: number;
  canvasHeight: number;
  lastFrameTime: number;
  frameRate: number;
  formRect: DOMRect | null;
} 